package us.wili.dev.model.validator.annotation;

import us.wili.dev.model.validator.valid.IntegerValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;

/**
 * 检验是否包涵values数组内的值
 * @author wkx
 * @date 2018/9/18 11:04
 */
@Target({FIELD, METHOD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = IntegerValidator.class)
public @interface IncludeIntValue {
    String message() default "请输入正确的值";

    /**
     * 如果前端传过来的值包涵了values数组里其中一个值就通过校验
     */
    int[] values() default {} ;
    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

}
